#!/usr/bin/perl
####################################################################
#
#   lsadptucode command
#
#   Syntax: lsadptucode
#
#	No parameters
#
####################################################################
#
#   Initial version - 04/16/03
#
####################################################################

sub exit_routine {
    
     # remove files from /tmp 
     
     exit $ret; 

} # end exit_routine subroutine


################################################################################
#
# start main body of code
#
################################################################################
$PRGRM  = "lsadptucode";
$BIN    = "/opt/hsc/bin"; 
$PARMS = 0;

$USAGE = "Usage: lsadptucode\n";

# First check for existence of parameters
if ($#ARGV ne -1) {
	$PARMS = 1;
}

if ($PARMS == 1)
{
#  	Parameters specified
#	print "Parameters specified\n";     #DEBUG
		print $USAGE;      #USAGE
		$ret = 1;
		&exit_routine;
}

chop($RC = `$BIN/i_stub_FS adptucode -P`);
if ($RC==50)
{
	print "Cannot connect to FNM Daemon\n";
}
elsif ($RC==52)
{
	print "Device Database not available\n";
}
else 
{
	print "Current adapter microcode levels:\n";
	print "[frame] [cage] [timestamp]\n";
	system "$BIN/i_stub_FS adptucode -P";
}
	
$ret = 0;
$exit_routine;
